package Comun;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import javax.swing.JLabel;

public class SaicButton extends JLabel {
    private Icon mousePressed;
    private Icon mouseReleased;
    private Icon mouseEntered;
    private Icon mouseExited;
    private Color Primario= Color.WHITE;
    private Color Secundario=Color.RED;

    public SaicButton() {
        
        this.setForeground(this.Primario);
        this.setSize(24, 24);
        this.setIcon(mouseExited);
        
        
        this.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent me) {
               setForeground(getSecundario());
               setIcon(getMousePressed()); 
               getParent().getParent().repaint();
            }

            @Override
            public void mouseReleased(MouseEvent me) {
                setForeground(getSecundario());
                setIcon(getMouseReleased()); 
                getParent().getParent().repaint();
            }

            @Override
            public void mouseEntered(MouseEvent me) {
                setForeground(getSecundario());
                setIcon(getMouseEntered()); 
                getParent().getParent().repaint();
            }

            @Override
            public void mouseExited(MouseEvent me) {
                setForeground(Primario);
                setIcon(getMouseExited());
               getParent().getParent().repaint();
            }
   
        });
       
        
        
    }

    
    @Override
    public void setDisplayedMnemonic(char c) {
        super.setDisplayedMnemonic(c);
        
    }

    @Override
    public void paintAll(Graphics grphcs) {
        super.paintAll(grphcs);
        getParent().getParent().repaint();
    }
    
    

    
    /**
     * @return the mousePressed
     */
    public Icon getMousePressed() {
        return mousePressed;
    }

    /**
     * @param mousePressed the mousePressed to set
     */
    public void setMousePressed(Icon mousePressed) {
        this.mousePressed = mousePressed;
    }

    /**
     * @return the mouseReleased
     */
    public Icon getMouseReleased() {
        return mouseReleased;
    }

    /**
     * @param mouseReleased the mouseReleased to set
     */
    public void setMouseReleased(Icon mouseReleased) {
        this.mouseReleased = mouseReleased;
    }

    /**
     * @return the mouseEntered
     */
    public Icon getMouseEntered() {
        return mouseEntered;
    }

    /**
     * @param mouseEntered the mouseEntered to set
     */
    public void setMouseEntered(Icon mouseEntered) {
        this.mouseEntered = mouseEntered;
    }

    /**
     * @return the mouseExited
     */
    public Icon getMouseExited() {
        return mouseExited;
    }

    /**
     * @param mouseExited the mouseExited to set
     */
    public void setMouseExited(Icon mouseExited) {
        this.mouseExited = mouseExited;
    }

    /**
     * @return the Primario
     */
    public Color getPrimario() {
        return Primario;
    }

    /**
     * @param Primario the Primario to set
     */
    public void setPrimario(Color Primario) {
        this.Primario = Primario;
    }

    /**
     * @return the Secundario
     */
    public Color getSecundario() {
        return Secundario;
    }

    /**
     * @param Secundario the Secundario to set
     */
    public void setSecundario(Color Secundario) {
        this.Secundario = Secundario;
    }


    
    
    
}
